box gadget: Improve assertion message
authorMatthias Clasen <mclasen@redhat.com>
Wed, 27 Jan 2016 03:11:54 +0000 (22:11 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 27 Jan 2016 03:11:54 +0000 (22:11 -0500)
Include the owner of the gadget in the assertion message,
to improve the chances of tracking down whats actually
going wrong here.

gtk/gtkboxgadget.c

index ea18a21c28d52094a9a643fbe248c874756faa8d..1adbcb6774cbdd9031a9800859ca9e3c4d4533f4 100644 (file)
@@ -133,7 +133,11 @@ gtk_box_gadget_distribute (GtkBoxGadget     *gadget,
       size -= sizes[i].minimum_size;
     }
 
-  g_return_if_fail (size >= 0);
+  if G_UNLIKELY (size < 0)
+    {
+      g_critical ("%s: assertion 'size >= 0' failed in %s", G_STRFUNC, G_OBJECT_TYPE_NAME (gtk_css_gadget_get_owner (GTK_CSS_GADGET (gadget))));
+      return;
+    }
 
   size = gtk_distribute_natural_allocation (size, priv->children->len, sizes);